package com.zhongyu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongyu.pojo.OrderDetail;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderDetailMapper   extends BaseMapper<OrderDetail> {



    //根据订单id查询订单详情
    @Select("select * from smbms_order_detail t1 where order_id=#{orderId}" )
    List<OrderDetail> findById(Integer orderId);

//根据订单详情id查 明细
@Select("select * from smbms_order_detail  where id=#{detailId}" )
List<OrderDetail> findBydetailId1(Integer detailId);

    @Select("select * from smbms_order_detail t1 \n"+
            "left JOIN smbms_order t2 ON t2.id=t1.order_id where t1.id=#{detailId}" )
    @ResultMap("orderDetailRm")
    OrderDetail  findBydetailId(Integer detailId);

    @Select("SELECT COUNT(*) FROM smbms_order_detail   where STATE=#{state} and order_id=#{orderId}")
     Integer getCount(OrderDetail orderDetail, Integer state, Integer orderId);


}
